import {defineStore} from 'pinia'
import { getMainColor, setMainColor } from '@/store/localStorage/index.js'
export const mainStore = defineStore('main', {
	state: () => ({
		nav: [],
		mainColor: '#1f2d3d',
		userInfo: {
			name: '张三',
			avatar: 'https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg'
		}
	}),
	actions: {
		setNav(v) {
			this.nav = v
		},
		setUserInfo(data) {
			this.userInfo = data
		},
		setMainColor(v) {
			this.mainColor = v
			setMainColor(v)
		}
	},
	getters: {
		getters_userInfo: (state) => {
			return state.userInfo
		},
		getters_mainColor: (state) => {
			return getMainColor() || state.mainColor
		}
	}
})